package com.opencursor;

import com.intellij.openapi.components.Service;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.util.xmlb.XmlSerializerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@Service
@State(name = "CursorSettings", storages = @Storage("cursor.xml"))
public final class CursorSettings implements PersistentStateComponent<CursorSettings> {
    private String cursorPath = "";

    public static CursorSettings getInstance() {
        return ApplicationManager.getApplication().getService(CursorSettings.class);
    }

    @Override
    public @Nullable CursorSettings getState() {
        return this;
    }

    @Override
    public void loadState(@NotNull CursorSettings state) {
        XmlSerializerUtil.copyBean(state, this);
    }

    public String getCursorPath() {
        return cursorPath;
    }

    public void setCursorPath(String cursorPath) {
        this.cursorPath = cursorPath;
    }
}